package com.longyiqun.cm.controller.server;

import com.longyiqun.cm.domain.BaseServerEntity;
import com.longyiqun.cm.service.ServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.websocket.server.PathParam;

@Controller
@RequestMapping("/server")
public class ServerControllerImpl implements ServerController {
    @Autowired
    ServerService serverService;
    @Override
    @RequestMapping("/baseServer")
    public String BaseServerList(Model model) {
        return "ServerManage/serverList";
    }
    @Override
    @RequestMapping("/buildRecord")
    public String BuildRecordList(Model model) {
        return "ServerManage/buildRecord";
    }

    @Override
    @RequestMapping("/buildAuditList")
    public String buildAuditList(Model model) {
        return "ServerManage/buildAuditList";
    }
    @Override
    @RequestMapping("/buildApply")
    public String BuildApply(Model model) {
        return "ServerManage/addBuildApply";
    }


    @Override
    @RequestMapping("/serverDetail")
    public String serverDetail(@PathParam("serverId") String serverId, Model model) {
        System.out.println(serverId+"=============");
        BaseServerEntity tc = serverService.findOneBaseServer(serverId);
        model.addAttribute("serverId", serverId);
        model.addAttribute("tc", tc);
        return "ServerManage/BaseServerDetail";
    }

    @Override
    @RequestMapping("/userLoginPage")
    public String UserLogin(Model model) {
        return "ServerManage/Login";
    }


    @Override
    @RequestMapping("/addNewServer")
    public String addServer(Model model) {
        return "ServerManage/addNewServer";
    }

}
